package Model1;
import java.io.*;
import java.util.*;

/**
 * 
 */
// 鸟类抽象类
abstract class Bird {
    protected SwimBehavior swimBehavior;
    protected FlyBehavior flyBehavior;

    public void setSwimBehavior(SwimBehavior swimBehavior) {
        this.swimBehavior = swimBehavior;
    }

    public void setFlyBehavior(FlyBehavior flyBehavior) {
        this.flyBehavior = flyBehavior;
    }

    public abstract void display();

    public void performSwim() {
        swimBehavior.swim();
    }

    public void performFly() {
        flyBehavior.fly();
    }
}